<?php

namespace App\Services\Fund;

use App\Services\ProjectValidate;

/**
 *
 * Class ValidateFundAccount
 * @package App\Services\Fund
 */
class ValidateFundAccount extends ProjectValidate
{

    /**
     * 自定义子类初始化
     * @param array $initData
     * @return mixed
     */
    public function initValidate($initData = [])
    {
        // TODO: Implement initValidate() method.
    }


    /**
     * @var array 用户模块的验证集合
     */
    public $rules = [
        'user_id' => 'integer|min:0',
        'obj_id' => 'integer|min:0',
        'order_id' => ['integer', 'gt' => '0'],
        'certi_transfer_fee' => ['number', 'egt' => '0'],
        'earnings' => ['number', 'egt' => '0'],
        'integral_deduction' => ['integer', 'egt' => '0'],
        'integral_deduction_money' => ['integer', 'egt' => '0'],
        'integral_deduction_currency' => ['number', 'egt' => '0'],
        'total_price' => ['number', 'egt' => '0'],
        'pay_method' => ['in'=>'cash,currency,alipay,wechat,unionpay'],
        'create_ip' => ['ip'],
        'update_ip' => 'ip',
        'app_id' => 'integer|min:0',
        'opposite_id' => 'integer|min:0|different:user_id',
        'borrow_log_id' => ['integer', 'gt' => '0'],
        'freeze_log_id' => ['integer', 'gt' => '0'],
        'user_ids' => ['length'=>'1,256'],
        'exchange' => 'in:Currency,Integral',
        'money' => 'integer|min:-1',
        'integral' => ['integer', 'egt' => '0'],
        'currency_scale' => 'integer|min:0|required_if:exchange,Currency',
        //'user_info' => ['regex:/^{.*}$/'],
        // 'opposite_info' => ['regex:/^{.*}$/'],
        'type' => 'in:goods,certificate,order',
        'freeze_counts' => 'integer|min:0',
        'reason' => 'min:5',
        'certificate_price' => ['number', 'gt'=>0],
        'certificate_id' => ['integer', 'gt'=>'0'],
        'certi_price' => ['integer', 'gt'=>'0'],
        'procedure_cost' => ['integer', 'gt'=>'0'],
    ];

    /**
     * @var array 当前验证错误信息
     */
    public $messages = [
    ];

    /**
     * @var array 上面规则中定义的 key 的名字
     */
    public $attributes = [
        'id'        => 'ID',
    ];

}